package cool.taomu.web.entity.sina

import java.io.Serializable
import java.text.DecimalFormat
import org.eclipse.xtend.lib.annotations.Accessors
import org.eclipse.xtend.lib.annotations.ToString

@Accessors
@ToString
class StockMarketEntity implements Serializable{
	String code;
	//股票名字 0
	String name;
	//今日开盘价 1
	float jrkpj; 
	//昨日收盘价 2
	float zrspj;
	//当前价格 3
	float dqjg;
	//今日最高价 4
	float jrzgj = 0;
	//今日最低价 5
	float jrzdj;
	//成交的股票数 8 由于股票交易以一百股为基本单位，所以在使用时，通常把该值除以一百；
	float sjgs;
	//成交金额 9 单位为“元”，为了一目了然，通常以“万元”为成交金额的单位，所以通常把该值除以一万
	float sjje;
	//日前  时间 30 31
	String date;
	String time;
	float zt;
	float dt;
	String rgb = "#e53612";
	float zdf;
	new(String code,String name,float jrkpj,float zrspj,float dqjg,float jrzgj,float jrzdj,float sjgs,float sjje){
		this.code = code;
		var df= new  DecimalFormat( ".00" )
		this.zt = zrspj + zrspj * 0.1f;
	 	this.zt = Float.parseFloat(df.format(this.zt));
	 	this.dt = zrspj - zrspj * 0.1f;
	 	this.dt = Float.parseFloat(df.format(this.dt));
	 	this.zdf = (dqjg - zrspj) / zrspj * 100;
	 	try{
	 		this.zdf = Float.parseFloat(df.format(this.zdf));
	 	}catch(Exception e){
	 		e.printStackTrace
	 		this.zdf = 0;	
	 	}
		this.name = name;
		this.jrkpj =jrkpj
		this.zrspj = zrspj
		this.dqjg = dqjg
		this.jrzgj = jrzgj
		this.jrzdj = jrzdj
		this.sjgs = sjgs;
		this.sjje = sjje;
		if(this.dqjg > this.zrspj){
			this.rgb = "#e53612";
		}else if(this.dqjg < this.zrspj){
			this.rgb = "#358712" ;
		}else{
			this.rgb = "#5e5757";
		}
	}
}